#include<bits/stdc++.h>
using namespace std;
int a,b,c;
bool fib(int n)
{
    return (n%a!=0 && n%b!=0 && n%c!=0);
}
int main()
{
    int n;cin >> n;
    int ans=0;
    cin >> a >> b >> c;
    do
    {
        if(fib(n)) ans++;
    }while(n--);
    cout << ans;
    return 0;
}